﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartSpace.WebForm.SystemTheme
{
    public partial class HeaderPanel : System.Web.UI.UserControl, IHeaderPanel
    {
        private Core.User _user;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public event LogoffEventHandler Logoff;

        public void Initiate(IEnumerable<SmartSpace.Core.Shortcut> shortcuts, List<SmartSpace.Core.Application> applications, SmartSpace.Core.Application currentApplication, SmartSpace.Core.User loginUser)
        {
            _user = loginUser;
            this._ctlLabelTitle.InnerText = currentApplication.Name;
            this._ctlBtnUser.Text = _user.Name;
        }

        protected void _ctlBtnLogoff_Click(object sender, EventArgs e)
        {
            if (Logoff != null)
            {
                Logoff(this, new LogoffEventArgs(_user));
            }
        }

        protected void _ctlBtnUser_Click(object sender, EventArgs e)
        {

        }
    }
}